package ch.hearc.detectionpresence.tests;

import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.googlecode.javacv.cpp.opencv_core.IplImage;

public class Hello {
	public static void main(String[] args) {
		String imagePath = "C:/Users/nils.amiet/Documents/INF3/Traitement_Images/projet/javacv-bin/samples/Blob1.jpg";
		String imagePath2 = "C:/Users/nils.amiet/Pictures/shots/2013-01-10-231544_995x1116_scrot.png";
		IplImage image = cvLoadImage(imagePath);
		BufferedImage img = image.getBufferedImage();

		final JFrame frame = new JFrame();
		frame.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				frame.dispose();
			}
		});
		frame.setTitle("exemple :)");
		frame.setVisible(true);

		ImageIcon icon = new ImageIcon();
		System.out.println(icon.getIconWidth());
		icon.setImage(img);
		JLabel label = new JLabel();
		label.setIcon(icon);
		frame.add(new JPanel().add(label));

		frame.pack();
	}
}
